package com.SouthernWall_404.age_tool;

import com.SouthernWall_404.age_tool.common.Network.ModChannels;
import com.SouthernWall_404.age_tool.common.event.AttachCapabilityEvent;
import com.SouthernWall_404.age_tool.common.event.onLeftClick;
import com.SouthernWall_404.age_tool.common.init.*;
import com.mojang.logging.LogUtils;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.entity.player.PlayerInteractEvent;
import net.minecraftforge.eventbus.api.IEventBus;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
import org.slf4j.Logger;

// The value here should match an entry in the META-INF/mods.toml file
@Mod(AgeTool.MODID)
public class AgeTool
{
    // Define mod id in a common place for everything to reference
    public static final String MODID = "age_tool";
    // Directly reference a slf4j logger
    private static final Logger LOGGER = LogUtils.getLogger();

    public AgeTool()
    {
        IEventBus modEventBus = FMLJavaModLoadingContext.get().getModEventBus();
        modEventBus.addListener(this::registerChannel);

        // Register ourselves for server and other game events we are interested in
        MinecraftForge.EVENT_BUS.register(this);

        MinecraftForge.EVENT_BUS.register(ModCommand.class);
        MinecraftForge.EVENT_BUS.register(AttachCapabilityEvent.class);
        MinecraftForge.EVENT_BUS.register(onLeftClick.class);

        modEventBus.addListener(ModCapability::onCapabilityRegister);

        MinecraftForge.EVENT_BUS.register(onLeftClick.class);

        ModItems.ITEMS.register(modEventBus);
        ModCreativeModeTab.CREATIVE_TABS.register(modEventBus);
        ModBlocks.BLOCKS.register(modEventBus);
        ModBlockEntities.BLOCK_ENTITY_TYPE.register(modEventBus);
        ModMenuType.MENU_TYPE.register(modEventBus);

    }

    private void registerChannel(FMLCommonSetupEvent event)
    {
        ModChannels.register();
    }
}
